package com.xiaobaibai.security.token.dao;

import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

//@Component
public class TokenUserDetailService implements UserDetailsService {

    /**
     * 我发先没必要将认证好的用户信息存入成功的token中,就废弃了
     */

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        String[] split = s.split("@");
        return new User(split[0],"jwt",true,true,
                true,true,
                AuthorityUtils.commaSeparatedStringToAuthorityList(split[1]));
    }

}
